# Contributor: Maxim Karasev <begs@disroot.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=gmid
pkgver=2.1
pkgrel=0
pkgdesc="Fast, small, and secure Gemini server"
url="https://www.omarpolo.com/pages/gmid.html"
arch="all !s390x" # test_unknown_host failed
license="ISC GPL-2.0-only"
makedepends="
	bison
	flex
	libbsd-dev
	libevent-dev
	libretls-dev
	openssl-dev
	"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/omar-polo/gmid/archive/$pkgver/gmid-$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	$pkgname.conf
	"

build() {
	# Not a gnuautoconf, just a shell script
	./configure PREFIX=/usr
	make
}

check() {
	make regress
}

package() {
	make DESTDIR="$pkgdir" BINDIR=/usr/bin MANDIR=/usr/share/man install
	install -Dm755 contrib/gencert contrib/renew-certs -t "$pkgdir"/usr/bin
	install -Dm644 "$srcdir"/gmid.confd "$pkgdir"/etc/conf.d/gmid
	install -Dm755 "$srcdir"/gmid.initd "$pkgdir"/etc/init.d/gmid
	install -Dm644 "$srcdir"/gmid.conf "$pkgdir"/etc/gmid.conf
}

sha512sums="
2156f1097d878a32b22dd97f6f575c49e65eabd8f06f0b04f8d0318c6d6aba69d34bc9f0e76db2d1f2da054237ab57bf5688620cfe4a24bd8b4167087ecc5f6d  gmid-2.1.tar.gz
b05d3685b66547d171a8feeb47518a9e27226a709a0a4d5a77e2cd51d7026ef4d3e0fc9e00a53e9fa58908b717df0bc0954452ab44d2158c949cdfec10b8cba5  gmid.confd
9d5c2fc00f08ab4fe187bfbd09d386b9daab39b7c984b0a2e6043ce0a66baf9b8a3d6609f8c4c41ed97e1e7161511ab7a7edea0e477bfce5eab10fcf10df27ba  gmid.initd
9ebbac15a6e3b34f70a4bbf1a1c4a70f8e6b733ce3b838829fbcc995cfc6681f216f80a8ddca526c60cdc9b9a16de071e5f93faa31b42be65d707ad52897730b  gmid.conf
"
